package com.sds.sweng.swat.miplatform.ui.design.models.component.logical;

import org.eclipse.draw2d.IFigure;

import com.sds.sweng.swat.miplatform.ui.design.figures.MLabel;
import com.sds.sweng.swat.miplatform.ui.design.figures.logical.LTextFigure;

public class LText extends LogicalComponent {

	public LText() {

	}

	public LText(String name, String id, int width, int height, String text, String format) {
		super(name, id, width, height, text, format);
	}

	public IFigure getFigure() {
		LTextFigure figure = new LTextFigure();
		figure.setText(getText());
		figure.setSize(getWidth(), getHeight());

		int align = MLabel.ALIGN_LEFT;
		if (LogicalComponent.ALIGN_CENTER.equals(getAlign()))
			align = MLabel.ALIGN_CENTER;
		else if (LogicalComponent.ALIGN_RIGHT.equals(getAlign()))
			align = MLabel.ALIGN_RIGHT;
		figure.setAlignment(align);

		return figure;
	}

}
